Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Collections.Specialized

Namespace WroxControls

   Public Class MyTextBoxVB
      Inherits WebControl

      Implements IPostBackDataHandler 
      
      Public Sub New()
         MyBase.New("input")
      End Sub 'New
      
      Public Event TextChanged As EventHandler
      
      Private _value As String
            
      Public ReadOnly Property Text As String
         Get
            Return _value
         End Get
      End Property
       
      Protected Overrides Sub AddAttributesToRender(writer As HtmlTextWriter)

         MyBase.AddAttributesToRender(writer)
         writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID)
         
         writer.AddAttribute(HtmlTextWriterAttribute.Type, "input")
         If Not (_value Is Nothing) Then
            writer.AddAttribute("value", _value)
         End If

      End Sub
       
      Function LoadPostData(postDataKey As String, postCollection As NameValueCollection) As Boolean _
		Implements IPostBackDataHandler.LoadPostData

         _value = postCollection(postDataKey)
         
         Return True
      End Function 
      
      
      Sub RaisePostDataChangedEvent() _
		  Implements IPostBackDataHandler.RaisePostDataChangedEvent
         
            RaiseEvent TextChanged(Me, EventArgs.Empty)
      End Sub
   End Class 

End Namespace 